package com.mercator.client.util;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.core.client.JsArrayString;
import com.google.gwt.dev.js.ast.JsBooleanLiteral;
import com.google.gwt.dev.json.JsonBoolean;

public final class JSONGene extends JavaScriptObject  {

	protected JSONGene(){};
	 
	 public final  Collection<String>  iterator() {
		 ArrayList<String> al = new ArrayList<String>();
		 JsArrayString jsarray = getKeys();
		 for(int i=0;i<jsarray.length();i++)
			 al.add(jsarray.get(i));
		 return al;
	  }
	  
	  public final native JsArrayString getKeys()/*-{
		  return Object.keys(this);
	  }-*/;
	 
	 public final boolean get(String prop){
		  return Boolean.parseBoolean(getVal(prop).toString());
	  }
	  
 public final native JavaScriptObject getVal(String prop)/*-{
	  return this[prop];
  }-*/;


}
